﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace TestBankingMandatory
{
    public class Account
    {
        private double _balance;
        private long _accountNum;
        private int _accountType;
        private double _interest;

        public double Balance
        {
            get { return _balance; }
            set { _balance = value; }
        }

        public long AccountNum
        {
            get { return _accountNum; }
            set { _accountNum = value; }
        }

        public int AccountType
        {
            get { return _accountType; }
            set { _accountType = value; }
        }

        public double Interest
        {
            get { return _interest; }
            set { _interest = value; }
        }
        
        public Account(double balance, long accountNum, int accountType)
        {
            _balance = balance;
            _accountNum = accountNum;
            _accountType = accountType;
        }

        public double Withdraw(double amount)
        {
            double newBalance = _balance;

            if (amount >= 0 && amount <= _balance)
            {
                newBalance = _balance - amount;

                _balance = newBalance;
            }

            return newBalance;
        }

        public double Deposit(double amount)
        {
            double newBalance = _balance;

            if (amount >= 0)
            {
                newBalance = _balance + amount;

                _balance = newBalance;
            }

            return newBalance;
        }

        public double AddInterest()
        {
            double newBalance = _balance;

            if (_interest >= 0)
            {
                newBalance = _balance + (_balance * _interest);
                _balance = newBalance;
            }
            
            return newBalance;
        }
    }
}
